package com.hex.ds.hdtp.core.inf.script.transfer.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.io.FilenameUtils;

import java.io.File;
import java.io.Serializable;
import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.inf.script.transfer.po
 * @ClassName ScriptConvertTargetListPo
 * @Description: 脚本转换转换后文件清单-PO对象
 * @Author: wz.li
 * @Date 2023/8/14 16:31
 * @Version v2.0.2
 **/
@Data
@Accessors(chain = true)
@TableName(value = "tm_script_convert_target_list")
public class ScriptConvertTargetListPo implements Serializable {

    @TableId(value = "pk_id",type = IdType.ASSIGN_UUID)
    private String pkId;

    @TableField(value = "convert_task_pk_id")
    private String convertTaskPkId;

    @TableField(value = "convert_source_list_pk_id")
    private String convertSourceListPkId;

    @TableField(value = "source_file_name")
    private String sourceFileName;

    @TableField(value = "source_file_path")
    private String sourceFilePath;

    @TableField(value = "source_file_size")
    private String sourceFileSize;

    @TableField(value = "convert_file_name")
    private String convertFileName;

    @TableField(value = "convert_file_path")
    private String convertFilePath;

    @TableField(value = "convert_file_size")
    private String convertFileSize;

    @TableField(value = "source_conn_code")
    private String sourceConnCode;

    @TableField(value = "target_conn_code")
    private String targetConnCode;

    @TableField(value = "empty_test_status")
    private String emptyTestStatus;

    @TableField(value = "start_time")
    private String startTime;

    @TableField(value = "end_time")
    private String endTime;

    @TableField(value = "error_message")
    private String errorMessage;

    @TableField(exist = false)
    private String sourceConnPkId;

    public String getSourceFileAbsolutePath() {
        return FilenameUtils.separatorsToUnix(sourceFilePath + File.separator + sourceFileName);
    }

    public String getConvertFileAbsolutePath() {
        return FilenameUtils.separatorsToUnix(convertFilePath + File.separator + convertFileName);
    }
}
